Adam Richardson's Site

Debian Notes

Table of Contents

<2024-02-04 Sun>

Flashing an image to USB Drive

  • sudo dd bs=4M if=<SOME_IMAGE> of=<SOME_DEVICE> status=progress oflag=sync

Sudo

  • Run su to become root
  • Add the user to the sudo group using the sudo command as root, sudo usermod -a -G sudo <USER>
  • Exit the su session and reboot and log back in

Wifi

  • Debian Wiki: iwlwifi
  • Edit your /etc/apt/sources.list to enable contrib and non-free packages
  • Add then to the end of each line that begins with deb or deb-src
deb http://deb.debian.org/debian bullseye main contrib non-free
deb-src http://deb.debian.org/debian bullseye main contrib non-free

deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free
deb-src http://deb.debian.org/debian-security/ bullseye-security main contrib non-free

deb http://deb.debian.org/debian bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian bullseye-updates main contrib non-free
  • Update your packages with sudo apt update
  • Install iwlwifi, sudo apt install firmware-iwlwifi
  • Become root with su
  • Load the iwlwifi module, sudo modprobe -r iwlwifi; modprobe iwlwifi
  • This might also be a good time to install any needed non-free firmware for your hardware. For example intel graphics i915
  • sudo apt install firmware-misc-nonfree

Bluetooth

  • Once the non-free packages are enabled you might need to install bluez-firmware to be able to connect to some bluetooth devices

Caps Lock / Control

  • To turn the caps lock key into control run this setxkbmap command when logging in, /usr/bin/setxkbmap -option "ctrl:nocaps"
  • To ensure that any keyboard connected has the above option, create the file /etc/X11/xorg.conf.d/90-custom-kbd.conf with the following contents
Section "InputClass"
    Identifier "keyboard defaults"
    MatchIsKeyboard "on"

    Option "XkbModel" "pc105"
    Option "XkbLayout" "us"
    Option "XKbOptions" "ctrl:nocaps"
EndSection

Packages

dpkg-query to see contents of package

  • dpkg-query will show you the files installed by a given package
  • dpkg-query -L <PACKAGE_NAME>

Package Listing

sudo apt install \
     mg \
     build-essential \
     git \
     git-gui \
     mosh \
     tmux \
     pass \
     pass-extension-otp \
     zbar-tools \
     libgccjit-12-dev \
     libjansson-dev \
     libjansson-doc \
     autoconf \
     autoconf-doc \
     texlive \
     texlive-extra-utils \
     texlive-latex-extra \
     texi2html \
     texinfo \
     libgtk-3-dev \
     libgtk-3-doc \
     libxpm-dev \
     libjpeg-dev \
     gnutls-bin \
     gnutls-doc \
     libtiff-dev \
     libtiff-doc \
     libgif-dev \
     libgnutls28-dev \
     libncurses-dev \
     imagemagick \
     imagemagick-doc \
     htop \
     ncdu \
     fonts-hack-ttf \
     syncthing \
     vlc \
     mpv \
     nethack-console \
     ledger \
     fonts-noto-cjk \
     fonts-noto-cjk-extra \
     fonts-noto-color-emoji \
     fonts-noto-core \
     fonts-noto-extra \
     libssl-dev \
     libssl-doc \
     libsasl2-dev \
     libdb-dev \
     db-util \
     libdb5.3 \
     db5.3-doc \
     libxapian-dev \
     libgmime-3.0-dev \
     libtalloc-dev \
     zlib1g-dev \
     libsdl2-dev \
     libsdl2-doc \
     libsdl2-ttf-dev \
     libusb-1.0-0-dev \
     pkg-config \
     fzf \
     libfreetype6 \
     libopenal1 \
     liblua5.1-0 \
     abcde \
     beets \
     beets-doc \
     inkscape \
     curl \
     picocom \
     rsync \
     default-jre \
     graphviz \
     info \
     sbcl \
     sbcl-doc \
     gimp \
     gimp-help-en \
     libxml2-dev \
     libgtk2.0-dev \
     iperf3 \
     python3-pip \
     flac \
     libmagickwand-dev \
     guile-3.0 \
     guile-3.0-dev \
     gnuplot \
     stow \
     libglew-dev \
     clangd \
     ripgrep \
     cmake \
     libtool-bin \
     clang \
     fatsort \
     p7zip-full \
     lowdown

Installing .deb files

  • You can use apt to install deb files.
  • This has the added benefit of getting the dependencies
  • sudo apt install ./<PACKAGE>.deb

Setting default python version

Suspending when closing the laptop lid

  • Debian Wiki: Systemd Suspend Sedation
  • Edit /etc/systemd/logind.conf
  • Find the lines with HandleLidSwitch and ensure that they are set to Suspend
  • Restart the login service with sudo systemctl restart systemd-logind
  • When using XFCE4 this can be handled in the power management settings

Syncthing

  • Start syncthing as a user service systemctl enable --now syncthing.service --user
  • The syncthing web ui is normally accessed on port 8384
  • To have syncthing start at boot you will need to enable user lingering
    • sudo loginctl enable-linger <USERNAME>

Isync

  • Clone the isync repo, git clone https://git.code.sf.net/p/isync/isync isync
  • Inside the isync code run ./autogen.sh
  • Run ./configure to create the Makefile
  • Then run make and make install

Notmuch

  • Download the latest source release of notmuch from their release page, https://notmuchmail.org/releases/
  • Run ./configure to create the Makefile
  • Then run make and make install

EDuke32

  • EDukeWiki: Building EDuke32 on Linux
  • Clone the latest code here, git clone https://voidpoint.io/terminx/eduke32.git
  • Ensure the dependencies are installed, sudo apt-get install build-essential nasm libgl1-mesa-dev libglu1-mesa-dev libsdl1.2-dev libsdl-mixer1.2-dev libsdl2-dev libsdl2-mixer-dev flac libflac-dev libvorbis-dev libvpx-dev libgtk2.0-dev freepats
  • Run make to build EDuke32
  • This produces eduke32 and mapster32 binaries, place them in your path somewhere

Adding User to uucp group

  • sudo usermod -a -G uucp <USER>

OpenRA

  • Clone the latest code here, git clone =https://github.com/OpenRA/OpenRA
  • Install the dependencies, sudo apt install libfreetype6 libopenal1 liblua5.1-0 libsdl2-2.0-0
  • Download .NET 6.0 from Microsoft, https://docs.microsoft.com/en-us/dotnet/core/install/linux-debian#debian-11
    • Make sure you set the environment variable, DOTNET_CLI_TELEMETRY_OPTOUT=1 since it is opt out telemetry
  • Compile the program with make
  • The game content should go in the ~/.config/openra/Content folder
  • To launch the game you need to use the launch-game.sh script inside the repo
  • When starting the game you need to specify the "mod" either cnc, ra or d2k
    • For example, from inside the repo dir, ./launch-game.sh Game.Mod=ra

Getting the Latest SBCL

  • The latest SBCL release can be downloaded here
  • To build from source clone the code with, git clone git://git.code.sf.net/p/sbcl/sbcl
  • You will need a Common Lisp implementation already installed compile SBCL
  • Inside the repo run sh make.sh to compile the code
  • After that use sudo sh install.sh to install the new SBCL implementation

Building Emacs

  • clone emacs from savannah git clone -b master git://git.sv.gnu.org/emacs.git
  • Releases are usually in a branch with the version number, for example emacs-28
  • Run the ./autogen.sh to build the configure script
  • The below command shows the configure flags I like for Emacs
./configure --with-native-compilation \
            --with-json \
            --with-rsvg \
            --with-imagemagick \
            --with-pgtk
  • This will warn you about any missing dependencies, from there you should obtain them for your OS
  • Build emacs with make -j <NUMBER_OF_CPU_CORES+1>
  • Run make install with appropriate permissions to install the new version on the system
  • Use M-x emacs-version RET to see the current version info, including the build date

Wireguard

  • Digital Ocean: How to Setup Wireguard on Debian 11
  • Install wireguard with sudo apt install wireguard
  • Generate a privatekey, wg genkey | sudo tee /etc/wireguard/private.key
  • Remove any permissions normal users have on the privatekey, sudo chmod go= /etc/wireguard/private.key
  • Create public key, sudo cat /etc/wireguard/private.key | wg pubkey | sudo tee /etc/wireguard/public.key
  • Decide what the ip address of this peer
  • Create a wg0.conf with the peer configuration in /etc/wireguard/wg0.conf
[Interface]
PrivateKey = <<my private key>>
Address = <<my ip address>>/32

[Peer]
PublicKey = <<server public key>>
AllowedIPs = 0.0.0.0/0
Endpoint = <<server public WAN ip>>:51820
  • Update the server with a peer that matches the ip address in the local config and the public key of the new peer
  • To bring up the connection run sudo wg-quick up wg0
  • To bring down the connection run sudo wg-quick down wg0

Go

  • The go package in debian sometimes makes it difficult to work with the tooling
  • The official go docs have a good guide on getting golang installed under /usr/local/go
  • Download the tarball for the correct CPU architecture from https://go.dev/dl/
  • Uncompress the tarball to /usr/local/ sudo tar -C /usr/local -xzf go1.20.4.linux-amd64.tar.gz
  • Add /usr/local/go/bin to your PATH
  • Ensure that the GOROOT is set to /usr/local/go

Common Go Tools

  • gopls LSP server, go install golang.org/x/tools/gopls@latest

Upgrading Debian Version

Upgrade current system

  • sudo apt update
  • sudo apt upgrade
  • sudo apt autoremove

Upgrade the name of the version in /etc/apt/sources.list

  • Open the sources.list and replace all instances of the current Toy Story character name with the next one
  • For example replace all instances of bullseye with bookworm

Upgrade to new version

  • sudo apt update
  • sudo apt upgrade
  • sudo apt full-upgrade

Reboot the system

  • sudo reboot

Confirm the new version

  • lsb_release -a Should show the name of the new Toy Story character

Clean up apt

  • sudo apt clean
  • sudo apt autoremove